package com.sicheng.蓝桥.练习题.dp;

import java.util.Scanner;

/**
 * @author zsc
 * @version 1.0
 * @date 2021/10/22 18:51
 */
@SuppressWarnings("all")
public class 砝码称重 {
    public static void main(String[] args) {
        int sum_weight = 0, ans = 0;
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] w = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            w[i] = scanner.nextInt();
            sum_weight += w[i];
        }
        boolean[][] dp = new boolean[n + 1][sum_weight * 4];
        dp[0][sum_weight * 2] = true;

        for (int i = 1; i <= n; i++) {
            for (int j = sum_weight; j < sum_weight * 3; j++) {
                dp[i][j] = //dp[i][j] ||
                        dp[i - 1][j] ||
                        dp[i - 1][j - w[i]] ||
                        dp[i - 1][j + w[i]];
            }
        }
        for (int i = 1; i <= sum_weight; ++i) {
            if (dp[n][sum_weight + i] || dp[n][sum_weight - i]) {
                ++ans;
            }
        }
        System.out.println(ans);

    }
}
